﻿using System.Collections.Generic;
using System.Web.Mvc;
using System.Web.Routing;
using Orchard.Environment.Extensions;
using Orchard.Mvc.Routes;

namespace ATTools
{
    [OrchardFeature("ATTools")]
    public class Routes : IRouteProvider
    {

        #region IRouteProvider Members

        public void GetRoutes(ICollection<RouteDescriptor> routes)
        {
            foreach (RouteDescriptor routeDescriptor in GetRoutes())
            {
                routes.Add(routeDescriptor);
            }
        }

        public IEnumerable<RouteDescriptor> GetRoutes()
        {
            return new[] {
                new RouteDescriptor {
                    Priority = 5,
                    Route = new Route(
                        "Admin/ATTools/TranslateText/{id}",
                        new RouteValueDictionary {
                            {"area", "ATTools"},
                            {"controller", "Admin"},
                            {"action", "Edit"}
                        },
                        new RouteValueDictionary {
                            {"id", @"\w+"}
                        },
                        new RouteValueDictionary {
                            {"area", "ATTools"}
                        },
                        new MvcRouteHandler())
                },
            };
        }

        #endregion
    }

    [OrchardFeature("ATTools.VoiceCommands")]
    public class RoutesVoice : IRouteProvider
    {

        #region IRouteProvider Members

        public void GetRoutes(ICollection<RouteDescriptor> routes)
        {
            foreach (RouteDescriptor routeDescriptor in GetRoutes())
            {
                routes.Add(routeDescriptor);
            }
        }

        public IEnumerable<RouteDescriptor> GetRoutes()
        {
            return new[] {
                new RouteDescriptor {
                    Route = new Route(
                        "Admin/ATTools/VoiceList",
                        new RouteValueDictionary {
                            {"area", "ATTools"},
                            {"controller", "VoiceAdmin"},
                            {"action", "VoiceList"}
                        },
                        new RouteValueDictionary(),
                        new RouteValueDictionary {
                            {"area", "ATTools"}
                        },
                        new MvcRouteHandler())
                },
                new RouteDescriptor {
                    Route = new Route(
                        "Admin/ATTools/NewVoiceCommand",
                        new RouteValueDictionary {
                            {"area", "ATTools"},
                            {"controller", "VoiceAdmin"},
                            {"action", "NewVoiceCommand"}
                        },
                        new RouteValueDictionary(),
                        new RouteValueDictionary {
                            {"area", "ATTools"}
                        },
                        new MvcRouteHandler())
                },
                new RouteDescriptor {
                    Route = new Route(
                        "Admin/ATTools/EditVoiceCommand/{id}",
                        new RouteValueDictionary {
                            {"area", "ATTools"},
                            {"controller", "VoiceAdmin"},
                            {"action", "EditVoiceCommand"}
                        },
                        new RouteValueDictionary {
                            {"id", @"\w+"}
                        },
                        new RouteValueDictionary {
                            {"area", "ATTools"}
                        },
                        new MvcRouteHandler())
                },
            };
        }

        #endregion
    }
}